package cn.huaqingcheng.tianshu.infrastructure.start;

import cn.huaqingcheng.tianshu.core.start.model.Site;
import cn.huaqingcheng.tianshu.core.start.model.SiteGroup;
import cn.huaqingcheng.tianshu.infrastructure.start.entity.SiteEntity;
import cn.huaqingcheng.tianshu.infrastructure.start.entity.SiteGroupEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * StartConvert
 */
@Mapper
public interface StartConvert {

    StartConvert INSTANCE = Mappers.getMapper(StartConvert.class);

    Site toModel(SiteEntity entity);

    @Mapping(target = "updatedAt", ignore = true)
    @Mapping(target = "createdAt", ignore = true)
    SiteEntity toEntity(Site model);

    @Mapping(target = "siteList", ignore = true)
    @Mapping(target = "children", ignore = true)
    SiteGroup toModel(SiteGroupEntity entity);

    @Mapping(target = "updatedAt", ignore = true)
    @Mapping(target = "createdAt", ignore = true)
    SiteGroupEntity toEntity(SiteGroup model);

}
